<html>
<head><meta charset="utf-8"><title>rustc platform intrinsics · project-portable-simd · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/index.html">project-portable-simd</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html">rustc platform intrinsics</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="236937888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236937888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236937888">(May 01 2021 at 04:54)</a>:</h4>
<p>Whats the process if i want to add a platform intrinsic such as <a href="https://llvm.org/docs/LangRef.html#llvm-umax-intrinsic"><code>umax/smax</code></a> to rustc? To implement min and max for non-float vectors</p>



<a name="236938013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236938013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236938013">(May 01 2021 at 04:56)</a>:</h4>
<p>i found the intrinsics file, would it be something like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">simd_max</span><span class="p">,</span><span class="w"> </span><span class="p">(</span><span class="n">c</span><span class="w"> </span><span class="n">x</span><span class="p">,</span><span class="w"> </span><span class="n">c</span><span class="w"> </span><span class="n">y</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">validate_simd_type</span><span class="o">!</span><span class="p">(</span><span class="n">fx</span><span class="p">,</span><span class="w"> </span><span class="n">intrinsic</span><span class="p">,</span><span class="w"> </span><span class="n">span</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">.</span><span class="n">layout</span><span class="p">().</span><span class="n">ty</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">simd_int_binop</span><span class="o">!</span><span class="p">(</span><span class="n">fx</span><span class="p">,</span><span class="w"> </span><span class="n">umax</span><span class="o">|</span><span class="n">smax</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="w"> </span><span class="n">y</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">ret</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>?</p>



<a name="236938059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236938059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236938059">(May 01 2021 at 04:57)</a>:</h4>
<p>im assuming its not <code>simd_int_flt_binop</code> because floats have <code>fmax</code> and <code>fmin</code></p>



<a name="236938134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236938134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236938134">(May 01 2021 at 04:58)</a>:</h4>
<p>Yeah, you can basically just copy what is done for other binops</p>



<a name="236938157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236938157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236938157">(May 01 2021 at 04:59)</a>:</h4>
<p>alright awesome, im assuming theres tests for this somewhere, right?</p>



<a name="236938170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236938170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236938170">(May 01 2021 at 04:59)</a>:</h4>
<p>There's a whole directory of simd tests for the compiler, yes</p>



<a name="236938176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236938176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236938176">(May 01 2021 at 04:59)</a>:</h4>
<p>I forget where exactly</p>



<a name="236938181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236938181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236938181">(May 01 2021 at 04:59)</a>:</h4>
<p>But it's in the test directory</p>



<a name="236938182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236938182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236938182">(May 01 2021 at 04:59)</a>:</h4>
<p>ill just grep it and see</p>



<a name="236938317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236938317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236938317">(May 01 2021 at 05:00)</a>:</h4>
<p>I'll PR umax/smax and umin/smin to rustc and then submit a draft relying on that to stdsimd, that sound good?</p>



<a name="236942995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236942995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236942995">(May 01 2021 at 06:23)</a>:</h4>
<p>?</p>



<a name="236943061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236943061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236943061">(May 01 2021 at 06:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="276242">Riccardo D'Ambrosio</span> <a href="#narrow/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics/near/236938317">said</a>:</p>
<blockquote>
<p>I'll PR umax/smax and umin/smin to rustc and then submit a draft relying on that to stdsimd, that sound good?</p>
</blockquote>
<p>Is this for vector or vector reduce?</p>



<a name="236989490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236989490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236989490">(May 01 2021 at 18:33)</a>:</h4>
<p><span class="user-mention" data-user-id="281757">@Jubilee</span> for vector, to add min and max for int vectors too, instead of just float vectors with fmin and fmax</p>



<a name="236989589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236989589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236989589">(May 01 2021 at 18:34)</a>:</h4>
<p>Yeah, <span class="user-mention" data-user-id="281757">@Jubilee</span> not reduction. Just normal min/max</p>



<a name="236989598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236989598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236989598">(May 01 2021 at 18:35)</a>:</h4>
<p>this intrinsic here <a href="https://llvm.org/docs/LangRef.html#llvm-umax-intrinsic">https://llvm.org/docs/LangRef.html#llvm-umax-intrinsic</a></p>



<a name="236989603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236989603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236989603">(May 01 2021 at 18:35)</a>:</h4>
<p>It could be implemented with select but might as well use the intrinsic</p>



<a name="236989621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236989621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236989621">(May 01 2021 at 18:35)</a>:</h4>
<p>as well as the smax and smin equivalents</p>



<a name="236989697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236989697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236989697">(May 01 2021 at 18:36)</a>:</h4>
<p>Im not sure what tests i should add when i PR this, are the kind of tests you added with <a href="https://github.com/rust-lang/rust/commit/003b8eadd7a476c51956fe447894532d6e21937e">simd_floor and others</a> enough?</p>



<a name="236989705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236989705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236989705">(May 01 2021 at 18:37)</a>:</h4>
<p>should also probably document these intrinsics somewhere <span aria-label="stuck out tongue" class="emoji emoji-1f61b" role="img" title="stuck out tongue">:stuck_out_tongue:</span></p>



<a name="236989738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236989738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236989738">(May 01 2021 at 18:37)</a>:</h4>
<p>esepcially since they don't show up in <code>std::intrinsics</code>, probably for a good reason i don't know about</p>



<a name="236989792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236989792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236989792">(May 01 2021 at 18:38)</a>:</h4>
<p>Yeah, I think you can mirror tests like those</p>



<a name="236989919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236989919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236989919">(May 01 2021 at 18:40)</a>:</h4>
<p>Will platform intrinsics eventually show up in docs somewhere or are they permanently cryptic?</p>



<a name="236990061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236990061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236990061">(May 01 2021 at 18:42)</a>:</h4>
<p>Likely no doc</p>



<a name="236990067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236990067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236990067">(May 01 2021 at 18:43)</a>:</h4>
<p>The intention is for them to only be consumed by the standard library</p>



<a name="236990150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236990150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236990150">(May 01 2021 at 18:44)</a>:</h4>
<p>They probably could be exposed in <code>std::intrinsics</code> but it's not really necessary</p>



<a name="236990241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236990241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236990241">(May 01 2021 at 18:45)</a>:</h4>
<p>i think it wouldnt hurt to have an unstable way to call them raw just like normal intrinsics and to document them</p>



<a name="236990448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236990448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236990448">(May 01 2021 at 18:48)</a>:</h4>
<p>Definitely a possibility</p>



<a name="236990464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236990464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236990464">(May 01 2021 at 18:48)</a>:</h4>
<p>The downside is that adding a new intrinsic becomes both a compiler and library change</p>



<a name="236990485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236990485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236990485">(May 01 2021 at 18:48)</a>:</h4>
<p>Not a big problem, just something to consider</p>



<a name="236990488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236990488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236990488">(May 01 2021 at 18:49)</a>:</h4>
<p>well, it still kind of is, since adding an intrinsic usually is for adding a function to core simd</p>



<a name="236990504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236990504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236990504">(May 01 2021 at 18:49)</a>:</h4>
<p>i think exposing an intrinsic then not using it in the library would be kind of useless dont you think?</p>



<a name="236990510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236990510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236990510">(May 01 2021 at 18:49)</a>:</h4>
<p>Yep, true</p>



<a name="236990820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236990820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236990820">(May 01 2021 at 18:54)</a>:</h4>
<p>How would this work? just expose the intrinsics module in coresimd?</p>



<a name="236992166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236992166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236992166">(May 01 2021 at 19:18)</a>:</h4>
<p>Actually, would it make sense to remove <code>fmin</code> and <code>fmax</code> and merge <code>umin, smin, and fmin</code> into just <code>min</code>? i dont see why they should be separate when add, sub, etc are unified</p>



<a name="236993706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236993706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236993706">(May 01 2021 at 19:46)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> is there a reason that simd_fmin and simd_fmax are separate and not generalized in cranelift and others? do they have weird semantics that can't be transfered to a generic function?</p>



<a name="236993727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236993727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236993727">(May 01 2021 at 19:46)</a>:</h4>
<p>I have no idea. They were introduced way before cg_clif was a thing.</p>



<a name="236993752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236993752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236993752">(May 01 2021 at 19:47)</a>:</h4>
<p>ah ok, sorry to bother <span aria-label="big smile" class="emoji emoji-1f604" role="img" title="big smile">:big_smile:</span></p>



<a name="236993798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236993798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236993798">(May 01 2021 at 19:47)</a>:</h4>
<p>i saw you said on another PR to set you as a reviewer over petrochenkov if its small, is that still the case?</p>



<a name="236993867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236993867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236993867">(May 01 2021 at 19:48)</a>:</h4>
<p>I believe it was petrochenkov who said that. I am personally fine with reviewing small changes.</p>



<a name="236993879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236993879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236993879">(May 01 2021 at 19:49)</a>:</h4>
<p>alright <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="236993900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236993900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236993900">(May 01 2021 at 19:49)</a>:</h4>
<p>They are separate in libc. Not sure if that's a satisfying answer, but likely why</p>



<a name="236993965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236993965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236993965">(May 01 2021 at 19:50)</a>:</h4>
<p>yeah they're called <code>maxnum</code> and <code>minnum</code>, not <code>fmax</code> and <code>fmin</code> in llvm</p>



<a name="236993981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236993981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236993981">(May 01 2021 at 19:50)</a>:</h4>
<p>although i dont think it should matter what they codegen to if they do the same thing</p>



<a name="236995648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995648">(May 01 2021 at 20:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="276242">Riccardo D'Ambrosio</span> <a href="#narrow/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics/near/236990241">said</a>:</p>
<blockquote>
<p>i think it wouldnt hurt to have an unstable way to call them raw just like normal intrinsics and to document them</p>
</blockquote>
<p>There already is, effectively.</p>



<a name="236995667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995667">(May 01 2021 at 20:19)</a>:</h4>
<p>right, but its really hard to find what intrinsics actually exist since its not documented anywhere</p>



<a name="236995726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995726">(May 01 2021 at 20:20)</a>:</h4>
<p>Well... they are not <em>really</em> meant to be used externally at the moment. Originally they were planned for an exposure to external consumers, but then that went away.</p>



<a name="236995750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995750">(May 01 2021 at 20:20)</a>:</h4>
<p>rustc has lots of poorly documented things that are not meant to be consumed externally.</p>



<a name="236995755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995755">(May 01 2021 at 20:20)</a>:</h4>
<p>that's true</p>



<a name="236995779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995779">(May 01 2021 at 20:21)</a>:</h4>
<p>This is intended to be <em>the</em> API that actually exposes them, in effect.</p>



<a name="236995806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995806">(May 01 2021 at 20:21)</a>:</h4>
<p>behind something actually sane and type-safe, instead of</p>



<a name="236995808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995808">(May 01 2021 at 20:21)</a>:</h4>
<p>the madness.</p>



<a name="236995811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995811">(May 01 2021 at 20:21)</a>:</h4>
<p>haha yeah</p>



<a name="236995818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995818">(May 01 2021 at 20:21)</a>:</h4>
<p>do you agree with removing fmin and fmax and generalizing it?</p>



<a name="236995882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995882">(May 01 2021 at 20:22)</a>:</h4>
<p>Uh don't remove them, just add an additional set.</p>



<a name="236995894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995894">(May 01 2021 at 20:22)</a>:</h4>
<p>Float min/max are more complex than they seem and there will probably be two eventually.</p>



<a name="236995911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995911">(May 01 2021 at 20:23)</a>:</h4>
<p>This is because there's a NaN-silencing one introduced in 2008 and then there's a NaN-propagating one specified in 2019. :D</p>



<a name="236995932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995932">(May 01 2021 at 20:23)</a>:</h4>
<p>yikes</p>



<a name="236995936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995936">(May 01 2021 at 20:23)</a>:</h4>
<p>the joys of float math :D</p>



<a name="236995943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995943">(May 01 2021 at 20:23)</a>:</h4>
<p>So, while it might make sense for one to be "synonymous" with normal min/max, uh</p>



<a name="236995985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995985">(May 01 2021 at 20:24)</a>:</h4>
<p>let's... think about that later.</p>



<a name="236995990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995990">(May 01 2021 at 20:24)</a>:</h4>
<p>so i should just add <code>simd_min</code> and <code>simd_max</code> for uint and int?</p>



<a name="236995993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236995993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236995993">(May 01 2021 at 20:24)</a>:</h4>
<p>yeah.</p>



<a name="236996017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236996017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236996017">(May 01 2021 at 20:24)</a>:</h4>
<p>alright, what kind of tests should i add? are stderr tests needed for this?</p>



<a name="236996148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236996148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236996148">(May 01 2021 at 20:26)</a>:</h4>
<p>Such simple functional tests to make sure it works are fine.</p>



<a name="236996160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236996160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236996160">(May 01 2021 at 20:27)</a>:</h4>
<p>have a test that guarantees it emits an error if it's used with a float.</p>



<a name="236996170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236996170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236996170">(May 01 2021 at 20:27)</a>:</h4>
<p>okay, RA is formatting codegen files wrong for some reason <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="236996246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236996246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236996246">(May 01 2021 at 20:28)</a>:</h4>
<p>stdarch and stdsimd will always be doing more extensive testing to make sure these things work.</p>



<a name="236996262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236996262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236996262">(May 01 2021 at 20:28)</a>:</h4>
<p>yeah</p>



<a name="236996393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236996393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236996393">(May 01 2021 at 20:31)</a>:</h4>
<p>what is stdarch btw? is it just <code>core::arch</code>?</p>



<a name="236996651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236996651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236996651">(May 01 2021 at 20:34)</a>:</h4>
<p>yup.</p>



<a name="236997100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236997100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236997100">(May 01 2021 at 20:42)</a>:</h4>
<p>i hope that llvm's fallback code for min/max is branchless</p>



<a name="236997122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236997122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236997122">(May 01 2021 at 20:42)</a>:</h4>
<p>what would branchless min/max look like? <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="236997166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236997166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236997166">(May 01 2021 at 20:44)</a>:</h4>
<p><a href="https://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax">https://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax</a></p>



<a name="236997231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236997231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236997231">(May 01 2021 at 20:44)</a>:</h4>
<p>thats pretty cursed but smart</p>



<a name="236997238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236997238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236997238">(May 01 2021 at 20:44)</a>:</h4>
<p>most of the stuff on that page is "pretty cursed, but smart"</p>



<a name="236997251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236997251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236997251">(May 01 2021 at 20:45)</a>:</h4>
<p>tbf all of this is cursed</p>



<a name="236997546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236997546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236997546">(May 01 2021 at 20:49)</a>:</h4>
<p>Yeah, do you have enough power to rebuild rustc? It'd be useful to run the patch and see what the assembly actually looks like.</p>



<a name="236997686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236997686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236997686">(May 01 2021 at 20:52)</a>:</h4>
<p>which patch? I can rebuild rustc in a couple minutes (from clean)</p>



<a name="236997757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236997757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236997757">(May 01 2021 at 20:52)</a>:</h4>
<p>Aha, yeah. The simd_min/max one, and see what the code actually looks like without optimizations on.</p>



<a name="236997795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236997795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236997795">(May 01 2021 at 20:53)</a>:</h4>
<p>does no-opts make it always fall back?</p>



<a name="236998038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236998038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236998038">(May 01 2021 at 20:57)</a>:</h4>
<p>we're more interested in post-optimization fallbacks. it's about target features.<br>
if you run your locally built rustc without target features on it will use whatever is baseline on your system, which is likely SSE2, which may trigger the fallback on its own. otherwise you can set RUSTFLAGS to disable SSE/SSE2.</p>



<a name="236998106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236998106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236998106">(May 01 2021 at 20:58)</a>:</h4>
<p>Whats the flag to give it no target features? Just target-features without anything?</p>



<a name="236998484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236998484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236998484">(May 01 2021 at 21:01)</a>:</h4>
<p>You can't actually disable all target features without doing some very strange things to the code rustc emits.</p>



<a name="236998568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236998568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236998568">(May 01 2021 at 21:01)</a>:</h4>
<p>You disable a feature by passing e.g. <code>-sse</code></p>



<a name="236998587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236998587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236998587">(May 01 2021 at 21:01)</a>:</h4>
<p>i see</p>



<a name="236998723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236998723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236998723">(May 01 2021 at 21:02)</a>:</h4>
<p>passing no target features does nothing to the set of target features specified.</p>



<a name="236998753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236998753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236998753">(May 01 2021 at 21:02)</a>:</h4>
<p>A target implies certain features on by default.</p>



<a name="236998820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236998820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236998820">(May 01 2021 at 21:02)</a>:</h4>
<p>Is there a reason rustc doesnt compile with the “max” features it can use? Like avx2</p>



<a name="236998837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236998837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236998837">(May 01 2021 at 21:02)</a>:</h4>
<p>Portability?</p>



<a name="236998976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236998976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236998976">(May 01 2021 at 21:03)</a>:</h4>
<p>rustc is shipped to millions of computers worldwide.</p>



<a name="236999035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236999035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236999035">(May 01 2021 at 21:03)</a>:</h4>
<p>Sorry i mean the binaries it makes, not rustc itself</p>



<a name="236999045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236999045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236999045">(May 01 2021 at 21:03)</a>:</h4>
<p>If those were compiled with the max features available, and those were AVX512, what would that do to people with even top of the line AMD machines?</p>



<a name="236999089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236999089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236999089">(May 01 2021 at 21:03)</a>:</h4>
<p>rustc <em>is</em> just another binary that rustc makes.</p>



<a name="236999333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236999333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236999333">(May 01 2021 at 21:05)</a>:</h4>
<p>yeah true</p>



<a name="236999430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236999430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236999430">(May 01 2021 at 21:05)</a>:</h4>
<p>Rust has no reason to believe that a binary you build on your machine will be used only for that given machine.</p>



<a name="236999497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/236999497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#236999497">(May 01 2021 at 21:06)</a>:</h4>
<p>Hmm yeah, i understand, so its better to just assume no features</p>



<a name="237000207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237000207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237000207">(May 01 2021 at 21:10)</a>:</h4>
<p>Is there/will there be an easy way to monomorphize simd functions with coresimd? Like make a function for avx, avx2, and avx512 and dispatch the right one dynamically</p>



<a name="237001457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237001457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237001457">(May 01 2021 at 21:19)</a>:</h4>
<p>No, that is out of scope.</p>



<a name="237002048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002048">(May 01 2021 at 21:25)</a>:</h4>
<p>The first thing I did when I was invited to sit down here was I gathered up all the RFCs and issues from the past of Rust... and found out how terribly, incredibly long an effort it has been, and how many times it has come relatively close only to slide back.</p>
<p>This  project group may have been formed in 2020 but the overall endeavor to get a portable SIMD API represents 6 years of labor.</p>



<a name="237002170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002170">(May 01 2021 at 21:26)</a>:</h4>
<p>Thus, I argue relentlessly for the sword-logic.<br>
Cut, lest we be cut.<br>
This endeavor has devoured better programmers than you or I.</p>



<a name="237002204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002204">(May 01 2021 at 21:27)</a>:</h4>
<p>haha</p>



<a name="237002274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002274">(May 01 2021 at 21:28)</a>:</h4>
<p>Good simd support is <a href="https://github.com/rust-lang/rust/issues/1">#1</a> on my list of things id like rust to have, i make a ton of high performance tools, we have rayon but no good stable simd library, which hurts, which is why id like to help</p>



<a name="237002314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002314">(May 01 2021 at 21:29)</a>:</h4>
<p>Im making a fluid engine and good simd would help an absolute ton in performance</p>



<a name="237002321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002321">(May 01 2021 at 21:29)</a>:</h4>
<p>Multiversioning is the kind of thing that can be sorted out later and people already have crates for it.</p>



<a name="237002401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002401">(May 01 2021 at 21:30)</a>:</h4>
<p><a href="https://crates.io/crates/multiversion">https://crates.io/crates/multiversion</a> some mysterious guy named Caleb made this one and it seems pretty good. :^)</p>



<a name="237002419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002419">(May 01 2021 at 21:30)</a>:</h4>
<p>Looks great</p>



<a name="237002446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002446">(May 01 2021 at 21:31)</a>:</h4>
<p>Yeah it can be something similar to rayon where rust provides the low level tools like thread spawning and crates build upon it</p>



<a name="237002540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002540">(May 01 2021 at 21:32)</a>:</h4>
<p>What are the major hurdles in getting simd support done? Is it making sure stuff works consistently across architectures and stuff? Or just bikeshedding an API and stuff to add?</p>



<a name="237002660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002660">(May 01 2021 at 21:34)</a>:</h4>
<p>architectural consistency, expanding the backend's capabilities, the paper-shuffling that is introducing a feature, writing the RFC, writing the guides... and oh yeah, some bikeshedding. :^)</p>



<a name="237002703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002703">(May 01 2021 at 21:34)</a>:</h4>
<p>ADVENTURES like finding out about the SPIRV backend, haha.</p>



<a name="237002732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002732">(May 01 2021 at 21:35)</a>:</h4>
<p>i suck at rustc related stuff, so id rather focus on stuff like guides and core</p>



<a name="237002819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237002819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237002819">(May 01 2021 at 21:36)</a>:</h4>
<p>Mostly because i find working on the rustc codebase painful</p>



<a name="237004599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237004599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237004599">(May 01 2021 at 22:08)</a>:</h4>
<p>there's a reason I like... recently did the stabilization process for a bunch of unrelated, non-SIMD features. So I could figure out how the flow actually works, y'see.</p>



<a name="237004694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237004694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237004694">(May 01 2021 at 22:09)</a>:</h4>
<p>I just don't like working on such a gigantic codebase i dont understand that has a bunch of codebase-specific things it needs (x.py)</p>



<a name="237004751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237004751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237004751">(May 01 2021 at 22:10)</a>:</h4>
<p>yeah, that's why I did all the practice runs. <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="237004754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237004754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237004754">(May 01 2021 at 22:10)</a>:</h4>
<p>someone needs to know, might as well be me.</p>



<a name="237004779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237004779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237004779">(May 01 2021 at 22:10)</a>:</h4>
<p>think ill let you figure out the painful rustc stuff then <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="237004782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237004782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237004782">(May 01 2021 at 22:10)</a>:</h4>
<p>~</p>



<a name="237004874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237004874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237004874">(May 01 2021 at 22:12)</a>:</h4>
<p>mostly just need to add the intrinsics to add stuff like clamp, min, max, abs, etc</p>



<a name="237004937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237004937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237004937">(May 01 2021 at 22:13)</a>:</h4>
<p>clamp is not an intrinsic, mostly.</p>



<a name="237004973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237004973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237004973">(May 01 2021 at 22:14)</a>:</h4>
<p>yeah, clamp is just min + max</p>



<a name="237004982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237004982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237004982">(May 01 2021 at 22:14)</a>:</h4>
<p>not sure if any arches have specific intrinsics for it</p>



<a name="237004988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237004988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237004988">(May 01 2021 at 22:14)</a>:</h4>
<p>we already have simd_fabs.</p>



<a name="237005047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237005047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237005047">(May 01 2021 at 22:15)</a>:</h4>
<p>abs sometimes has a faster instruction, but our current version is 3 ops, it's not exactly a huge speed gain to go to 1 when it's a somewhat uncommon op.</p>



<a name="237005069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237005069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237005069">(May 01 2021 at 22:16)</a>:</h4>
<p>should i compile a list of the intrinsics that need to be added for <a href="https://github.com/rust-lang/stdsimd/issues/14">#14</a> ?</p>



<a name="237005134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237005134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237005134">(May 01 2021 at 22:16)</a>:</h4>
<p>like for <a href="https://github.com/rust-lang/stdsimd/issues/46">https://github.com/rust-lang/stdsimd/issues/46</a> sure</p>



<a name="237005236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237005236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237005236">(May 01 2021 at 22:18)</a>:</h4>
<p><span class="user-mention" data-user-id="276242">@Riccardo D'Ambrosio</span> If you look into <code>std</code>, you'll find that a lot of mathematical operations are implemented "in software", so it's fine if ours are as well. We mostly need the comparatively primitive operations.</p>



<a name="237005268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237005268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237005268">(May 01 2021 at 22:19)</a>:</h4>
<p>as in, clamp as min + max? i think llvm will make it into one if it makes sense</p>



<a name="237005899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237005899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237005899">(May 01 2021 at 22:28)</a>:</h4>
<p>abs isn't even written like ours is, it's literally a branch, because it's just assumed LLVM will optimize that.</p>



<a name="237005931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237005931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237005931">(May 01 2021 at 22:29)</a>:</h4>
<p>is there no integer power intrinsic?</p>



<a name="237006019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006019">(May 01 2021 at 22:30)</a>:</h4>
<p>oh apparently everyone just uses <code>exp(y * log(x))</code></p>



<a name="237006041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006041">(May 01 2021 at 22:31)</a>:</h4>
<p>should this be implemented at the library level or should it codegen to this at the rustc level?</p>



<a name="237006116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006116">(May 01 2021 at 22:32)</a>:</h4>
<p>You can think of <code>core</code> as the rust-to-rust codegen layer of rustc</p>



<a name="237006247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006247">(May 01 2021 at 22:34)</a>:</h4>
<p>i see</p>



<a name="237006307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006307">(May 01 2021 at 22:35)</a>:</h4>
<p>SSE2 has a function for the reciprocal of a float, but only for 32 bit floats, and i found an odd algorithm using newton-raphson to do it for 64 bits</p>
<div class="codehilite"><pre><span></span><code> __m128 nr = _mm_rsqrt_ps( x );
 __m128 muls = _mm_mul_ps( _mm_mul_ps( x, nr ), nr );
 result = _mm_mul_ps( _mm_mul_ps( half, nr ), _mm_sub_ps( three, muls ) );
</code></pre></div>



<a name="237006380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006380">(May 01 2021 at 22:36)</a>:</h4>
<p>i dont think llvm has an intrinsic for rcpps though, at least i cant find one</p>



<a name="237006400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006400">(May 01 2021 at 22:36)</a>:</h4>
<p>So the problem is we need to make sure it's IEEE 754</p>



<a name="237006405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006405">(May 01 2021 at 22:37)</a>:</h4>
<p>yeah <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="237006406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006406">(May 01 2021 at 22:37)</a>:</h4>
<p>And I'm guessing that's an approximation</p>



<a name="237006417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006417">(May 01 2021 at 22:37)</a>:</h4>
<p>yeah it is</p>



<a name="237006425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006425">(May 01 2021 at 22:37)</a>:</h4>
<p>Approximate functions is probably outside of our scope (since they apply to scalar std as well)</p>



<a name="237006435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006435">(May 01 2021 at 22:37)</a>:</h4>
<p>i believe rsqrt has 23 bits of accuracy</p>



<a name="237006488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006488">(May 01 2021 at 22:38)</a>:</h4>
<p>maybe just implement it as a simple division and hope llvm finds a way to optimize it if it can?</p>



<a name="237006500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006500">(May 01 2021 at 22:39)</a>:</h4>
<p>LLVM is extremely good at optimizing as long as you don't do something very weird</p>



<a name="237006520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006520">(May 01 2021 at 22:39)</a>:</h4>
<p>yeah, this is pretty common so i would be surprised if llvm didnt find a way to optimize it</p>



<a name="237006526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006526">(May 01 2021 at 22:39)</a>:</h4>
<p>So yeah, I'd expect it to be able to handle it ok. If it doesn't then we can go from there, but the order of priority is probably something like API and then performance generally</p>



<a name="237006728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006728">(May 01 2021 at 22:43)</a>:</h4>
<p>power is going to be really weird to implement</p>



<a name="237006735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006735">(May 01 2021 at 22:43)</a>:</h4>
<p>from what i can tell there is no straight forward way to cleanly implement it</p>



<a name="237006800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006800">(May 01 2021 at 22:44)</a>:</h4>
<p>pow for integers that is</p>



<a name="237006880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237006880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237006880">(May 01 2021 at 22:45)</a>:</h4>
<p>there are ways of abusing float to int conversions to do it but that might get wrong real quick for imprecision</p>



<a name="237007452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237007452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237007452">(May 01 2021 at 22:55)</a>:</h4>
<p>We absolutely cannot convert a float to an integer and then back again unless we can then verify that every single platform's floats are going to handle the conversion correctly.</p>



<a name="237007495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237007495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237007495">(May 01 2021 at 22:56)</a>:</h4>
<p>and even then no.</p>



<a name="237007503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237007503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237007503">(May 01 2021 at 22:56)</a>:</h4>
<p>not everyone has floating point operations.</p>



<a name="237007511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237007511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237007511">(May 01 2021 at 22:56)</a>:</h4>
<p>yeah, then we need to find another algorithm for doing this since afaik intrinsics for it dont exist</p>



<a name="237007519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237007519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237007519">(May 01 2021 at 22:56)</a>:</h4>
<p>which is wonderful <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="237007525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237007525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237007525">(May 01 2021 at 22:56)</a>:</h4>
<p>power is not that hard.</p>



<a name="237007566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237007566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237007566">(May 01 2021 at 22:57)</a>:</h4>
<p>you might be right, i only researched it a tiny bit</p>



<a name="237008127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237008127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237008127">(May 01 2021 at 23:05)</a>:</h4>
<p>So first, we don't support negative pow, so that helps.</p>



<a name="237008189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237008189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237008189">(May 01 2021 at 23:06)</a>:</h4>
<p>for x pow y where y = 0, we return 1</p>



<a name="237008218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237008218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237008218">(May 01 2021 at 23:07)</a>:</h4>
<p>for x pow y where y = 1, we return x</p>



<a name="237008306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237008306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237008306">(May 01 2021 at 23:08)</a>:</h4>
<p>for x pow y where y = 2.., we return (x * x) * etc.</p>



<a name="237008354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237008354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237008354">(May 01 2021 at 23:09)</a>:</h4>
<p>so for xs pow ys,<br>
start with zs = splat(1)<br>
set xs to 1 in all lanes where ys is 0<br>
zs = zs mul xs<br>
ys = ys - 1<br>
loop until end</p>



<a name="237008738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237008738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237008738">(May 01 2021 at 23:15)</a>:</h4>
<p>i see</p>



<a name="237008752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237008752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237008752">(May 01 2021 at 23:15)</a>:</h4>
<p>i wonder if llvm will optimize it into something else</p>



<a name="237008959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237008959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237008959">(May 01 2021 at 23:19)</a>:</h4>
<p>If you don't think it will be very fast, then there is no particular reason to implement it. I do not know of any architectures that offer such an accelerated function.</p>



<a name="237009278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237009278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237009278">(May 01 2021 at 23:24)</a>:</h4>
<p>i think it's fast enough, i dont think most pow operations will use a large power</p>



<a name="237009284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237009284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237009284">(May 01 2021 at 23:24)</a>:</h4>
<p>but knowing llvm, it has a lot of hacks for optimizing trivial things</p>



<a name="237009389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237009389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237009389">(May 01 2021 at 23:26)</a>:</h4>
<p>In fact... I can't find anything accelerating this on integers for Intel or Arm, so I am just striking it from the lists.</p>



<a name="237029511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237029511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237029511">(May 02 2021 at 05:53)</a>:</h4>
<p><span class="user-mention" data-user-id="276242">@Riccardo D'Ambrosio</span> clamp is actually a little more complicated than simple max and min when nan is involved (yay!)</p>



<a name="237029566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237029566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237029566">(May 02 2021 at 05:54)</a>:</h4>
<p>oh of course, who doesnt love NaN!</p>



<a name="237029627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237029627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237029627">(May 02 2021 at 05:55)</a>:</h4>
<p>you get to pick if you want to carry the nan up or suppress the nan</p>



<a name="237029675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237029675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237029675">(May 02 2021 at 05:56)</a>:</h4>
<p>what do the IEEE gods say?</p>



<a name="237029692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237029692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237029692">(May 02 2021 at 05:56)</a>:</h4>
<p>dunno</p>



<a name="237029700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237029700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237029700">(May 02 2021 at 05:56)</a>:</h4>
<p>nan is yummy! :P</p>



<a name="237029720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237029720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237029720">(May 02 2021 at 05:57)</a>:</h4>
<p>honestly we probably want both styles</p>



<a name="237029722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237029722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237029722">(May 02 2021 at 05:57)</a>:</h4>
<p>nan tastes like pain</p>



<a name="237029731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237029731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237029731">(May 02 2021 at 05:57)</a>:</h4>
<p>oh wonderful, two versions of clamp <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="237029744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237029744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237029744">(May 02 2021 at 05:57)</a>:</h4>
<p><a href="https://en.wikipedia.org/wiki/Naan">https://en.wikipedia.org/wiki/Naan</a></p>



<a name="237029951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237029951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237029951">(May 02 2021 at 06:01)</a>:</h4>
<p>iirc there's 3 different versions of min/max functions across the different IEEE 754 versions</p>



<a name="237030828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237030828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237030828">(May 02 2021 at 06:18)</a>:</h4>
<p>oh man, that is actual pain</p>



<a name="237055744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237055744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237055744">(May 02 2021 at 14:19)</a>:</h4>
<p>No, there's only one clamp in Rust.<br>
for clamp(min, max, val)<br>
if val is Nan,<br>
then return Nan,<br>
and min and max <strong>cannot</strong> be Nan.</p>



<a name="237055812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237055812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237055812">(May 02 2021 at 14:20)</a>:</h4>
<p>thus this version would use the 2019 version of min/max, which is the "NaN-propagating" version</p>



<a name="237070760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237070760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237070760">(May 02 2021 at 18:15)</a>:</h4>
<p>I think this is the only reasonable option for clamp, because <code>NAN.clamp(1, 2)</code> picking either <code>1</code> or <code>2</code> seems wrong.</p>
<p>(In other words, the <code>min</code>/<code>max</code> that ignore NAN are treating it like a monadic identity, but that interpretation doesn't make sense with <code>clamp</code>.)</p>



<a name="237071671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237071671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237071671">(May 02 2021 at 18:28)</a>:</h4>
<p>We really should follow pre-existing specs for clamp:<br>
<a href="https://www.khronos.org/registry/spir-v/specs/unified1/OpenCL.ExtendedInstructionSet.100.html#_a_id_common_a_common_instructions">https://www.khronos.org/registry/spir-v/specs/unified1/OpenCL.ExtendedInstructionSet.100.html#_a_id_common_a_common_instructions</a></p>
<blockquote>
<p>fclamp</p>
<p>Returns fmin(fmax(x, minval), maxval). Results are undefined if minval &gt; maxval.</p>
</blockquote>
<blockquote>
<p>fmax</p>
<p>Returns y if x &lt; y, otherwise it returns x. If one argument is a NaN, fmax returns the other argument. If both arguments are NaNs, fmax returns a NaN.</p>
<p>Result Type, x and y must be floating-point or vector(2,3,4,8,16) of floating-point values.</p>
<p>All of the operands, including the Result Type operand, must be of the same type.</p>
<p>Note: fmax behaves as defined by C99 and may not match the IEEE 754-2008 definition for maxNum with regard to signaling NaNs. Specifically, signaling NaNs may behave as quiet NaNs</p>
</blockquote>
<blockquote>
<p>fmin</p>
<p>Returns y if y &lt; x, otherwise it returns x. If one argument is a NaN, fmin returns the other argument. If both arguments are NaNs, fmin returns a NaN.</p>
<p>Result Type, x and y must be floating-point or vector(2,3,4,8,16) of floating-point values.</p>
<p>All of the operands, including the Result Type operand, must be of the same type.</p>
<p>Note: fmin behaves as defined by C99 and may not match the IEEE 754-2008 definition for minNum with regard to signaling NaNs. Specifically, signaling NaNs may behave as quiet NaNs</p>
</blockquote>



<a name="237071692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237071692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jacob Lifshay <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237071692">(May 02 2021 at 18:29)</a>:</h4>
<p>in particular this means <code>NAN.clamp(1.0, 2.0) == 1.0</code></p>



<a name="237073466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237073466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237073466">(May 02 2021 at 18:59)</a>:</h4>
<p>Frankly, I care more about conformance with existing Rust and IEEE754 semantics than I care about Khronos' opinions, and where I care about IEEE754, I care more about the most recent specification. 2008's maxNum and minNum were largely mistakes.</p>



<a name="237074001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237074001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237074001">(May 02 2021 at 19:06)</a>:</h4>
<p>I tend to agree that we should follow IEEE more closely than anything else</p>



<a name="237074009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237074009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237074009">(May 02 2021 at 19:06)</a>:</h4>
<p>Khronos' clampMin is fine. It's not like a sin against God or whatever. It's not going to eat my babies. I just don't really see any particular reason to inflict it on our codebase here. I'm already knives-out for basic mathematical functions like <code>pow</code> just because I can't find a hardware accelerated version. :P</p>



<a name="237074113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237074113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237074113">(May 02 2021 at 19:08)</a>:</h4>
<p>I feel like for any comparisons, if you put a NaN in you should get a NaN out? Which I think is the direction the latest IEEE 754 went?</p>



<a name="237074146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237074146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237074146">(May 02 2021 at 19:08)</a>:</h4>
<p>yeah</p>



<a name="237074214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237074214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237074214">(May 02 2021 at 19:09)</a>:</h4>
<p>they didn't specify which NaN, tho', which they should've (anything, even "the left one" is fine) but like, whatever</p>



<a name="237074332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237074332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237074332">(May 02 2021 at 19:10)</a>:</h4>
<p>In general that's more useful because then you can just let your nans propagate and check at the end of an operation</p>



<a name="237074883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237074883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237074883">(May 02 2021 at 19:16)</a>:</h4>
<p>yeah, that's basically The Argument.</p>



<a name="237078409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237078409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237078409">(May 02 2021 at 20:06)</a>:</h4>
<p><span class="user-mention silent" data-user-id="229517">Jacob Lifshay</span> <a href="#narrow/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics/near/237071692">said</a>:</p>
<blockquote>
<p>in particular this means <code>NAN.clamp(1.0, 2.0) == 1.0</code></p>
</blockquote>
<p>Yeah, that's just so arbitrary.  There's no reason for the definition to be that instead of <code>fmax(fmin(x, maxval), minval)</code>.</p>
<p>If they're going to make it undefined for <code>minval &gt; maxval</code> anyway, they should have just let it be an unspecified value meeting the postcondition if they don't want it returning NAN for NAN inputs.</p>



<a name="237160111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237160111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237160111">(May 03 2021 at 13:27)</a>:</h4>
<p>I don't dislike the semantics of clampMin there — I think a clamp that's guaranteed to produce a result inside the provided bounds is actually what you want a lot of the time... But I think it's more important that we follow the semantics of f32::clamp and such</p>



<a name="237187616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237187616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237187616">(May 03 2021 at 16:19)</a>:</h4>
<p>yeah i want a "clamp into this range" that <em>always</em> actually gets into that range.</p>



<a name="237187971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237187971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237187971">(May 03 2021 at 16:21)</a>:</h4>
<p>but i don't care if it has an alternate name like <code>clamp_strict</code> and then NaN propagation is the normal <code>clamp</code></p>



<a name="237188385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237188385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237188385">(May 03 2021 at 16:25)</a>:</h4>
<p>Maybe I'm being intentionally dense, but why is clamp special and shouldn't propagate nans unlike everything else?</p>
<p>I feel like <code>x.eq(x).select(x, default).clamp(min, max)</code> is the appropriate way to implement that</p>



<a name="237190108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237190108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237190108">(May 03 2021 at 16:38)</a>:</h4>
<p>because clamp is already doing some comparisons and if you simply order the comparisons properly you can clamp out the nans "for free", and then you can do things like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">math_here</span><span class="p">().</span><span class="n">clamp_strict</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span><span class="w"> </span><span class="mf">1.0</span><span class="p">)</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mf">255.0</span><span class="p">;</span><span class="w"></span>
<span class="c1">// safety: `f` is known to be within the range 0.0 to 255.0 because of the strict clamp</span>
<span class="k">unsafe</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">f</span><span class="p">.</span><span class="n">to_int_unchecked</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="237190208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237190208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237190208">(May 03 2021 at 16:39)</a>:</h4>
<p>I'd be curious to see how LLVM optimizes my example</p>



<a name="237190409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237190409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237190409">(May 03 2021 at 16:41)</a>:</h4>
<p>Not at a desktop, but I'll try to remember to investigate later today if you haven't looked in to it by then</p>



<a name="237190457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237190457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237190457">(May 03 2021 at 16:41)</a>:</h4>
<p>oh wait we don't have the lib in nightly so godbolt isn't available for it. that'd be a big pain</p>



<a name="237190711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237190711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237190711">(May 03 2021 at 16:44)</a>:</h4>
<p>Yeah it wouldn't be trivial</p>



<a name="237190835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237190835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237190835">(May 03 2021 at 16:44)</a>:</h4>
<p>I can do it with stdarch it'd just be kinda more tedious</p>



<a name="237190921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237190921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237190921">(May 03 2021 at 16:45)</a>:</h4>
<p>I know that AVX will return the non-nan value by default, but I don't think we should assume that's the "default" behavior. NEON returns nan for example</p>



<a name="237191212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237191212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237191212">(May 03 2021 at 16:47)</a>:</h4>
<p>big "thanks, i hate it" vibes</p>



<a name="237194614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237194614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237194614">(May 03 2021 at 17:11)</a>:</h4>
<p>Neon is correct :^)</p>



<a name="237195109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237195109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237195109">(May 03 2021 at 17:15)</a>:</h4>
<p>anyways like I said, I don't hate Khronos' choice of a clampMin, it's mostly just that the choice is arbitrary i m o.<br>
If you would rather use the upper bound or the lower bound always, that's something I think a programmer knows and we kinda don't.</p>



<a name="237195230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237195230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237195230">(May 03 2021 at 17:16)</a>:</h4>
<p>and having three functions for clamp is like "really?"</p>



<a name="237195425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237195425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237195425">(May 03 2021 at 17:17)</a>:</h4>
<p>Not to mention you may want something else entirely, like 0</p>



<a name="237195876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237195876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237195876">(May 03 2021 at 17:21)</a>:</h4>
<p>oh yes, "NaN is 0" is a common alternative choice.</p>



<a name="237196268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237196268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237196268">(May 03 2021 at 17:24)</a>:</h4>
<p>In fact the real thing we should do is make it easy to substitute all the values in a float vector where the value is NaN with some other value.</p>



<a name="237196381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237196381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237196381">(May 03 2021 at 17:25)</a>:</h4>
<p>Oh whoops, I remembered there's an easier way to do that</p>



<a name="237196439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237196439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237196439">(May 03 2021 at 17:25)</a>:</h4>
<p>Oh?</p>



<a name="237196446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237196446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237196446">(May 03 2021 at 17:25)</a>:</h4>
<p><code>x.is_nan().select(default, x)</code></p>



<a name="237196469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237196469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237196469">(May 03 2021 at 17:25)</a>:</h4>
<p>Ah! Then we've already done that.</p>



<a name="237196563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237196563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237196563">(May 03 2021 at 17:26)</a>:</h4>
<p>I'm extremely happy with this select interface, honestly.  Everything comes out so clean</p>



<a name="237196644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237196644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237196644">(May 03 2021 at 17:26)</a>:</h4>
<p>I'm not sure we need to provide all sorts of weird special selects</p>



<a name="237196781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237196781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237196781">(May 03 2021 at 17:27)</a>:</h4>
<p>yeah no, that's good enough.</p>



<a name="237214671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237214671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237214671">(May 03 2021 at 19:24)</a>:</h4>
<p>alright if everyone else is voting for nan-pass-up clamp I'll defer this to later.</p>



<a name="237215846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237215846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237215846">(May 03 2021 at 19:32)</a>:</h4>
<p>I do think there'd be value in a version that forces to the minimum. If there's a big performance hit in doing so, or if people want to propagate NaN to detect it as an error, I can also imagine having a version that doesn't.</p>



<a name="237216291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237216291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237216291">(May 03 2021 at 19:35)</a>:</h4>
<p>I think the question is if that's really necessary over <code>x.is_nan().select(min, x).clamp(min, max)</code></p>



<a name="237216414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237216414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237216414">(May 03 2021 at 19:36)</a>:</h4>
<p>It's admittedly more verbose, but it's still relatively concise and there's no question as to what it's doing</p>



<a name="237216772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237216772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237216772">(May 03 2021 at 19:38)</a>:</h4>
<p>I just can't think of a function name that relays the same amount of information</p>



<a name="237217703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237217703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237217703">(May 03 2021 at 19:45)</a>:</h4>
<p>Yes, not handling NaNs but having an explicit NaN-handling step tends to be faster.</p>



<a name="237217848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237217848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237217848">(May 03 2021 at 19:46)</a>:</h4>
<p>And yeah, we should teach people to use the library and then I think after we see patterns we might produce a simpler library helper function, much like many popular conventions for Rust were proposed as std helper functions like 5 years later.</p>



<a name="237217996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237217996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237217996">(May 03 2021 at 19:47)</a>:</h4>
<p>If I'm understanding select properly, I believe <code>clamp_strict</code> would be: </p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">x</span><span class="p">.</span><span class="n">gt</span><span class="p">(</span><span class="n">min</span><span class="p">).</span><span class="n">select</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">lt_eq</span><span class="p">(</span><span class="n">max</span><span class="p">).</span><span class="n">select</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="w"> </span><span class="n">max</span><span class="p">),</span><span class="w"> </span><span class="n">min</span><span class="p">)</span><span class="w"></span>
</code></pre></div>



<a name="237218379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237218379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237218379">(May 03 2021 at 19:50)</a>:</h4>
<p>I was making the assumption that LLVM would be able to better optimize an explicit nan check step</p>



<a name="237218478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237218478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237218478">(May 03 2021 at 19:50)</a>:</h4>
<p>Since it can assume the clamp that follows is nanless</p>



<a name="237218601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237218601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237218601">(May 03 2021 at 19:51)</a>:</h4>
<p>i would like if that were the case but i don't assume that's the case</p>



<a name="237218719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237218719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237218719">(May 03 2021 at 19:52)</a>:</h4>
<p>Well I'd like to check, but llvm has a specific nanless optimization</p>



<a name="237218804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237218804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237218804">(May 03 2021 at 19:53)</a>:</h4>
<p><a href="https://llvm.org/docs/LangRef.html#id1340">https://llvm.org/docs/LangRef.html#id1340</a></p>



<a name="237218813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237218813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237218813">(May 03 2021 at 19:53)</a>:</h4>
<p><code>nnan</code></p>



<a name="237218834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237218834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237218834">(May 03 2021 at 19:53)</a>:</h4>
<p>the internals of a strict clamp i'm not concerned about, the practical effect that i want is that if you call strict clamp to a finite min and max, the output value is a finite value <em>somewhere</em> in that range</p>



<a name="237219025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237219025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237219025">(May 03 2021 at 19:54)</a>:</h4>
<p>So one of my concerns is that if we start adding functions that arbitrarily discard nans you can no longer assume that functions pass nans and you need to learn the behavior of every particular function</p>



<a name="237219095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237219095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237219095">(May 03 2021 at 19:55)</a>:</h4>
<p>well it has an extra long name and stuff :P</p>



<a name="237219215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237219215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237219215">(May 03 2021 at 19:56)</a>:</h4>
<p>Haha yeah my thought is at that point it's more verbose than just using <code>is_nan</code> and <code>select</code></p>



<a name="237219556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237219556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237219556">(May 03 2021 at 19:59)</a>:</h4>
<p>yeah but then everyone has to think of it and write it out that way every time instead of getting a shorthand.</p>



<a name="237219764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237219764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237219764">(May 03 2021 at 20:00)</a>:</h4>
<p>Well then that brings us to <span class="user-mention" data-user-id="281757">@Jubilee</span>'s idea of a <code>replace_nan</code> function which is probably unnecessary but a compromise there</p>



<a name="237219855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237219855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237219855">(May 03 2021 at 20:00)</a>:</h4>
<p>But I think learning about select is a one time experience</p>



<a name="237219896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237219896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237219896">(May 03 2021 at 20:01)</a>:</h4>
<p>And probably necessary to using stdsimd</p>



<a name="237220039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237220039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237220039">(May 03 2021 at 20:02)</a>:</h4>
<p>but you have to read the code and then process out "okay so if i have this mask, now i select, and then i have these inputs... okay so that means now all the lanes are non-nan, okay"</p>



<a name="237220119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237220119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237220119">(May 03 2021 at 20:02)</a>:</h4>
<p>and even if you're seeing the same phrase over and over, <em>you learned that magic phrase</em>, and even if you learn the magic phrase you have to look each time to see "oh is this exactly the one i'm used to?"</p>



<a name="237220194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237220194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237220194">(May 03 2021 at 20:03)</a>:</h4>
<p>i mean there's a reason we have clamp at all to begin within, and not just a chain of max and min calls</p>



<a name="237220321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237220321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237220321">(May 03 2021 at 20:04)</a>:</h4>
<p>IMO, if we give it time to bake, the obvious solution will just kind of jump on us.</p>



<a name="237220695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237220695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237220695">(May 03 2021 at 20:07)</a>:</h4>
<p>Maybe. I'm just concerned were going to end up with <code>clamp_nan_to_min</code>, <code>clamp_nan_to_max</code>, <code>clamp_nan_to_zero</code>... And that's just clamp</p>



<a name="237220742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237220742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237220742">(May 03 2021 at 20:07)</a>:</h4>
<p>Yeaaah, that's why I am against prematurely adding anything.</p>



<a name="237220847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237220847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237220847">(May 03 2021 at 20:08)</a>:</h4>
<p>I'm not sure we should be adding anything that doesn't exist for scalar primitives because if there wasn't a compelling reason to add them there I don't see why SIMD is special</p>



<a name="237220922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/rustc%20platform%20intrinsics/near/237220922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/rustc.20platform.20intrinsics.html#237220922">(May 03 2021 at 20:08)</a>:</h4>
<p>Unless it's something that's unique to SIMD (which this isn't)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>